<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title><?php echo CHtml::encode($this->pageTitle); ?></title>

        <link href="<?php echo Yii::app()->theme->baseUrl; ?>/views/layouts/css/main.css" rel="stylesheet" type="text/css" />
        <link href="<?php echo Yii::app()->theme->baseUrl; ?>/views/layouts/css/cuprum.css" rel="stylesheet" type="text/css" />
        
        <?php
        Yii::app()->clientScript->registerCoreScript('jquery');
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/spinner/jquery.mousewheel.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/spinner/ui.spinner.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/jquery-ui-1.8.11.min.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/fileManager/elfinder.min.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/wysiwyg/jquery.wysiwyg.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/wysiwyg/wysiwyg.image.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/wysiwyg/wysiwyg.link.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/wysiwyg/wysiwyg.table.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/flot/jquery.flot.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/flot/jquery.flot.pie.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/flot/excanvas.min.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/dataTables/jquery.dataTables.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/dataTables/colResizable.min.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/forms/forms.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/forms/autogrowtextarea.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/forms/autotab.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/forms/jquery.validationEngine-en.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/forms/jquery.validationEngine.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/colorPicker/colorpicker.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/uploader/plupload.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/uploader/plupload.html5.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/uploader/plupload.html4.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/uploader/jquery.plupload.queue.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/ui/progress.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/ui/jquery.jgrowl.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/ui/jquery.tipsy.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/ui/jquery.alerts.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/jBreadCrumb.1.1.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/cal.min.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/jquery.collapsible.min.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/jquery.ToTop.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/jquery.listnav.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/jquery.sourcerer.js");
        Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/views/layouts/js/custom.js");

        ?>
    </head>

    <body>
        <!-- Top navigation bar -->
        <div id="topNav">
            <div class="fixed">
                <div class="wrapper">
                    <div class="welcome">
                        <?php
                        echo CHtml::link(CHtml::image(Yii::app()->baseUrl . "/../uploads/users/" . User::model()->findByPk(Yii::app()->user->id)->avatarUrl, '', array('width' => '22', 'height' => '20')), array('user/view', 'id' => Yii::app()->user->id));
                        ?>
                        <span>Welcome, <?php echo Yii::app()->user->name; ?></span>
                    </div>
                    <div class="userNav">
                        <ul>
                            <li><a href="<?php echo FRONTEND_LINK; ?>" target="_blank" title=""><img src="<?php echo Yii::app()->theme->baseUrl; ?>/views/layouts/images/icons/topnav/mainWebsite.png" alt="" /><span>Main Website</span></a></li>
                            <li>
                                <?php
                                $img = CHtml::image(Yii::app()->theme->baseUrl . '/views/layouts/images/icons/topnav/logout.png');
                                echo CHtml::link($img . '<span>Logout</span>', array("site/logout"));
                                ?>
                            </li>
                        </ul>
                    </div>
                    <div class="fix"></div>
                </div>
            </div>
        </div>

        <!-- Header -->
        <div id="header" class="wrapper">
            <div class="logo"><a href="/" title=""><img src="<?php echo Yii::app()->theme->baseUrl; ?>/views/layouts/images/loginLogo.png" alt="" /></a></div>
            <div class="middleNav">
                <ul>
                    <li class="iMes"><a href="#" title=""><span>Support tickets</span></a><span class="numberMiddle">9</span></li>
                    <li class="iStat">
                        <a href="#" title=""><span>Statistics</span></a>
                    </li>
                    <li class="iUser"><a href="#" title=""><span>User list</span></a></li>
                    <li class="iOrders"><a href="#" title=""><span>Billing panel</span></a></li>
                </ul>
            </div>
            <div class="fix"></div>
        </div>


        <!-- Content wrapper -->
        <div class="wrapper">

            <!-- Left navigation -->
            <?php
            $controllerId = Yii::app()->controller->id;
            $actionId = Yii::app()->controller->action->id;
            ?>
            <div class="leftNav">
                <ul id="menu">
                    <li class="dash">
                        <?php
                        echo CHtml::link("<span>Dashboard</span>", array("site/index"), array("class" => Helper::checkActiveCurrentNavigation($controllerId, "SITE")));
                        ?>
                    </li>
                    <li class="contacts"><a href="#" title="" class="exp<?php echo Helper::checkActiveCurrentNavigation($controllerId, "USER"); ?>"><span>User</span></a>
                        <ul class="sub" style="<?php echo Helper::checkDisplayBlockNavigation($controllerId, "USER") ?>">
                            <li><?php echo CHtml::link("Add User", array("user/create")); ?></li>
                            <li><?php echo CHtml::link("User List", array("user/admin")); ?></li>
                            <li class="last"><?php echo CHtml::link("Deleted List", array("user/deletedlist")); ?></li>
                        </ul>
                    </li>
                    <li class="categories"><a href="#" title="" class="exp<?php echo Helper::checkActiveCurrentNavigation($controllerId, "PRODUCTCATEGORY"); ?>"><span>Book Category</span></a>
                        <ul class="sub">
                            <li><?php echo CHtml::link("Add Book Category", array("productCategory/create")); ?></li>
                            <li><?php echo CHtml::link("Category List", array("productCategory/admin")); ?></li>
                            <li class="last"><?php echo CHtml::link("Deleted List", array("productCategory/deletedlist")); ?></li>
                        </ul>
                    </li>
                    <li class="products"><a href="#" title="" class="exp<?php echo Helper::checkActiveCurrentNavigation($controllerId, "PRODUCT"); ?>"><span>Book</span></a>
                        <ul class="sub">
                            <li><?php echo CHtml::link("Add Book", array("product/create")); ?></li>
                            <li><?php echo CHtml::link("Book List", array("product/admin")); ?></li>
                            <li class="last"><?php echo CHtml::link("Deleted List", array("product/deletedlist")); ?></li>
                        </ul>
                    </li>
                    <li class="products"><a href="#" title="" class="exp<?php echo Helper::checkActiveCurrentNavigation($controllerId, "ORDER"); ?>"><span>Order</span></a>
                        <ul class="sub">
                            <li><?php echo CHtml::link("Order List", array("order/admin")); ?></li>
                            <li class="last"><?php //echo CHtml::link("Deleted List", array("order/deletedlist")); ?></li>
                        </ul>
                    </li>
                    <li class="commentz"><a href="#" title="" class="exp<?php echo Helper::checkActiveCurrentNavigation($controllerId, "PRODUCTCOMMENT"); ?>"><span>Comment</span></a>
                        <ul class="sub">
                            <li><?php echo CHtml::link("Comment List", array("productComment/admin")); ?></li>
                            <li class="last"><?php //echo CHtml::link("Deleted List", array("productComment/deletedlist")); ?></li>
                        </ul>
                    </li>
                </ul>
            </div>

            <!-- Content -->
            <div class="content">
                <!--BREADCRUMB-->
                <?php if (isset($this->breadcrumbs)): ?>
                    <div class="breadCrumbHolder module">
                        <div class="breadCrumb module">
                            <?php
                            $this->widget('application.library.DucBreadcrumbs', array(
                                'links' => $this->breadcrumbs,
                                'separator' => '',
                                'tagName' => 'ul', //tag of surrounding HTML component
                            ));
                            ?>
                        </div>
                    </div>
                <?php endif; ?>

                <!-- HEADTITLE -->
                <?php if (isset($this->headTitle)): ?>
                    <div class="title"><h5><?php echo $this->headTitle; ?></h5></div>
                <?php endif; ?>

                <!-- NAVIGATION -->
                <?php
                echo DMenu::renderDMenu($this->navigation);
                ?>

                <!--MESSENGER-->
                <?php  
                $flashMessages = Yii::app()->user->getFlashes();
                if ($flashMessages){
                    foreach ($flashMessages as $key => $message){
                        if (strcmp($key, 'success') == 0)
                            echo Messenger::StatusSuccess($message);
                        elseif (strcmp($key, 'error') == 0)
                            echo Messenger::StatusError($message);
                        elseif (strcmp($key, 'notice') == 0)
                            echo Messenger::StatusInformation($message);
                    }
                }
                ?>

                <?php echo $content; ?>
            </div>
            <div class="fix"></div>
        </div>

        <!-- Footer -->
        <div id="footer">
            <div class="wrapper">
                <span>&copy; Copyright 2011. All rights reserved. It's Brain admin theme by <a href="#" title="">Eugene Kopyov</a></span>
            </div>
        </div>

    </body>
</html>
